home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d3 / rettig.arc / TRSOURCE.EXE / DIRMAKE.C < prev    next >
C/C++ Source or Header  |  1990-10-22  |  957b  |  50 lines

  1. /*********
  2. *  DIRMAKE
  3. *
  4. *  by Leonard Zerman 
  5. *
  6. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  7. *
  8. *  Syntax: DIRMAKE( <expC> )
  9. *  Return: Logical .T. if successful else .F.
  10. *  Note  : .T. IF the directory already exists.
  11. *********/
  12.  
  13. #include <trlib.h>
  14.  
  15. static char path[67]; 
  16. char *get_dir();
  17.  
  18. TRTYPE dirmake()
  19. {
  20.    char *dirptr;
  21.    int status;
  22.  
  23.    if(PCOUNT == 1 && ISCHAR(1))
  24.    {
  25.        dirptr  = _parc(1);
  26.        status  = get_drive();
  27.        status += 'A';
  28.        path[0] = (char)status;
  29.        path[1] = ':';
  30.        _tr_strcpy(path+2,get_dir());
  31.  
  32.        status = set_dir(dirptr);
  33.        if (status == ERRORNEG)
  34.        {
  35.           status = _tr_mkdir(dirptr);
  36.           if (status == ERRORNEG)
  37.              _retl(FALSE);
  38.           else
  39.              _retl(TRUE);
  40.        }
  41.        else
  42.        {
  43.           set_dir(path);
  44.           _retl(TRUE);
  45.        }
  46.    }
  47.    else
  48.       _retl(FALSE);
  49. }
  50.